import pandas as pd
import numpy as np

# 设置随机种子以便复现
np.random.seed(42)

# 生成数据
num_samples = 1000  # 数据样本数量
win_odds = np.round(np.random.uniform(1.0, 3.0, num_samples), 2)  # 主胜赔率
draw_odds = np.round(np.random.uniform(2.0, 4.0, num_samples), 2)  # 平局赔率
lose_odds = np.round(np.random.uniform(1.0, 3.0, num_samples), 2)  # 客胜赔率
handicap = np.round(np.random.uniform(-2.0, 2.0, num_samples) * 2, 1) / 2  # 盘口取值为0.5的整数倍

# 随机生成结果
results = np.random.choice([1, 2, 3], size=num_samples, p=[0.4, 0.2, 0.4])  # 主胜、平局、客胜的概率

# 创建 DataFrame
data = pd.DataFrame({
    'win_odds': win_odds,
    'draw_odds': draw_odds,
    'lose_odds': lose_odds,
    'handicap': handicap,
    'result': results
})

# 保存到 CSV 文件
data.to_csv('match_data.csv', index=False)
print("数据集已生成并保存为 match_data.csv") 